<?php

//
class dingyuejiluModule extends Model
{
    public function __construct()
    {
        parent::__construct("dingyuejilu");
    }

    /**
     * 查询用户订阅栏目
     * @date: 2019年6月14日 下午3:31:43
     * @param: variable
     * @return:
     * @author: 龚华尧
     */
    public function getdingyuelistByYonghu($yonghu)
    {
        $guanjiancitongjiM = new guanjiancitongjiModule();
        $list = $guanjiancitongjiM->getalldingyuelanmuList();
        $guanjianciStr = "";
        foreach ($list as $k => $v) {
            $temp["yonghu"] = $yonghu;
            $temp["leixing"] = $v["value"];
            $dingyuedetail = $this->where($temp)->one();

            if (count($dingyuedetail) == 0) {
                unset($list[$k]);
                continue;
            } else {
                $v['id'] = $dingyuedetail['id'];
                $list[$k] = $v;
            }
            if ($v["guanjianci"] != "") {
                if ($guanjianciStr == "") {
                    $guanjianciStr = $v["guanjianci"];
                } else {
                    $guanjianciStr = $guanjianciStr . "," . $v["guanjianci"];

                }
            }

        }

        $guanjianciList = explode(",", $guanjianciStr);
        if (count($guanjianciList) > 0) {
            foreach ($guanjianciList as $k => $v) {
                $_item['id'] = "";
                $_item["name"] = $v;
                $list[] = $_item;
            }
        }


        return $list;


    }

}